package com.oracle.service.impl;

import java.util.Date;

import org.springframework.transaction.annotation.Transactional;

import com.oracle.dao.LogDao;
import com.oracle.dao.UserDao;
import com.oracle.model.Log;
import com.oracle.model.User;
import com.oracle.service.UserService;

public class UserServiceImpl implements UserService {
	private UserDao userDao;
	private LogDao logDao;

	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	

	public LogDao getLogDao() {
		return logDao;
	}

	public void setLogDao(LogDao logDao) {
		this.logDao = logDao;
	}

	@Override
	@Transactional
	public void addUser(User user) {
		this.userDao.save(user);
//		Thread.sleep(10000000);
		Log log = new Log();
		log.setId(1);
		log.setMsg("user saved!!!");
		log.setDate(new Date());
		this.logDao.save(log);
		System.out.println(user);
	}
}
